<template>
  <div class="content-container">
    <h2 style="padding-left:30px">单用户画像</h2>
    <el-row :gutter="10">
      <el-col :span="6" class="content-left">
        <div style="margin-left:20px">
          <img src="../../../assets/images/head.svg" alt=""/>
        </div>
        <div style="line-height:50px;">
          <img src="../../../assets/images/prevattr.svg" align="Middle" alt=""
               style="margin-top:-10px;"/>&nbsp;&nbsp;<span>预设用户属性</span>
        </div>
        <div>
          <div class="index__profile-item___2Ep7n">
            <div class="index__profile-item-box___3v5O7">
              <label>登录ID</label><span>{{ userInfoData.login_id }}</span>
            </div>
            <div class="index__profile-item-box___3v5O7"><label>设备ID</label><span>{{ userInfoData.distinct_id }}</span></div>
            <div class="index__profile-item-box___3v5O7"><label>城市</label><span>{{ userInfoData.city }}</span></div>
            <div class="index__profile-item-box___3v5O7"><label>首次广告系列来源</label><span>{{ userInfoData.utm_source }}</span></div>
            <div class="index__profile-item-box___3v5O7"><label>iOS渠道追踪匹配模式</label><span>{{ userInfoData.utm_matching_type }}</span></div>
            <div class="index__profile-item-box___3v5O7"><label>首次流量来源类型</label><span>{{ userInfoData.first_traffic_source_type }}</span></div>
            <div class="index__profile-item-box___3v5O7"><label>用户名</label><span>{{ userInfoData.name }}</span></div>
            <div class="index__profile-item-box___3v5O7"><label>首次浏览器字符类型</label><span>{{ userInfoData.first_browser_charset }}</span></div>
            <div class="index__profile-item-box___3v5O7"><label>首次前向域名</label><span>{{ userInfoData.first_referrer_host }}</span></div>
            <div class="index__profile-item-box___3v5O7"><label>首次访问时间</label><span>{{ userInfoData.first_visit_time }}</span></div>
            <div class="index__profile-item-box___3v5O7"><label>首次广告系列名称</label><span>{{ userInfoData.utm_campaign }}</span></div>
            <div class="index__profile-item-box___3v5O7"><label>注册时间</label><span>{{ userInfoData.register_time }}</span></div>
            <div class="index__profile-item-box___3v5O7"><label>首次广告系列媒介</label><span>{{ userInfoData.utm_medium }}</span></div>
            <div class="index__profile-item-box___3v5O7"><label>首次广告系列字词</label><span>{{ userInfoData.utm_term }}</span></div>
            <div class="index__profile-item-box___3v5O7"><label>首次广告系列内容</label><span>{{ userInfoData.utm_content }}</span></div>
            <div class="index__profile-item-box___3v5O7"><label>用户更新时间</label><span>{{ userInfoData.update_time }}</span></div>
            <div class="index__profile-item-box___3v5O7"><label>省份</label><span>{{ userInfoData.province }}</span></div>
            <div class="index__profile-item-box___3v5O7"><label>首次搜索引擎关键词</label><span>{{ userInfoData.first_search_keyword }}</span></div>
            <div class="index__profile-item-box___3v5O7"><label>首次前向地址</label><span>{{ userInfoData.first_referrer }}</span></div>
            <div class="index__profile-item-box___3v5O7"><label>首次使用的浏览器语言</label><span>--</span></div>
<!--            first_browser_language-->
          </div>
        </div>
      </el-col>
      <el-col :span="18"  class="content-right">
          <div class="index__content___3xrWj">
              <div style="background-color: #fff;">
                <el-select slot="label" v-model="userType" placeholder="关注标签" class="labelTit">
                <el-option label="关注标签" value="1" />
              </el-select>
            </div>
<!--            <div class="index__model_tags___1-PXC">-->
<!--              <div class="index__tags___24Vkg">-->
<!--                  <div class="index__tag___3Ug-V">-->
<!--                    <span>优惠券偏好</span><span>:</span><span>未知</span>-->
<!--                  </div>-->
<!--              </div>-->
<!--              <div class="index__tags___24Vkg">-->
<!--                <div class="index__tag___3Ug-V">-->
<!--                  <span>优惠券敏感度</span><span>:</span><span>未知</span>-->
<!--                </div>-->
<!--              </div>-->
<!--              <div class="index__tags___24Vkg">-->
<!--                <div class="index__tag___3Ug-V">-->
<!--                  <span>优惠券偏好</span><span>:</span><span>未知</span>-->
<!--                </div>-->
<!--              </div>-->
<!--            </div>-->
            <div class="index__all_tags___3HoCH">
              <p class="index__title___3e4ql">全部标签</p>
              <p class="index__desc___D3hEk ">展示该用户全部共 {{ otherData.allTagCount }} 个标签信息</p>
<!--              <div v-for="(item,index) in tagsData">-->
<!--                <el-tree icon-class='el-icon-folder' :data="item" :props="defaultProps" @node-click="handleNodeClick"></el-tree>-->
<!--              </div>-->
              <div>
                <el-tree  icon-class='el-icon-folder' :data="data" :props="defaultProps" @node-click="handleNodeClick"></el-tree>
              </div>
<!--              <div>-->
<!--                <el-tree  icon-class='el-icon-folder' :data="data" :props="defaultProps" @node-click="handleNodeClick"></el-tree>-->
<!--              </div>-->
<!--              <div>-->
<!--                <el-tree  icon-class='el-icon-folder' :data="data" :props="defaultProps" @node-click="handleNodeClick"></el-tree>-->
<!--              </div>-->
            </div>
          </div>
      </el-col>
    </el-row>

  </div>
</template>

<script>
  import {getUserInfo} from "@/api/base/group";
  import {getUserinfotagsByType} from "@/api/tags/tag";

export default {
  name: "userPortrait",
  components: {},
  data() {

    return {
      // 遮罩层
      loading: true,
      otherData:{
        allTagCount:""
      },
      userInfoData:{},
      tagsData:[


      ],
      data: [
      //   {
      //   label: '活跃标签',
      //   children: [
      //     {
      //       label: '访问活跃度：未知'
      //     },
      //     {
      //       label: '流失用户：高度流失'
      //     },
      //     {
      //       label: '最后一次活跃距今天数：315'
      //     },
      //     {
      //       label: '标签393：未知'
      //     }
      //   ]
      // },
      //   {
      //     label: '活跃标签1',
      //     children: [
      //       {
      //         label: '访问活跃度：未知'
      //       },
      //       {
      //         label: '流失用户：高度流失'
      //       },
      //       {
      //         label: '最后一次活跃距今天数：315'
      //       },
      //       {
      //         label: '标签393：未知'
      //       }
      //     ]
      //   }
      ],
      defaultProps: {
        children: 'children',
        label: 'label'
      }

    };
  },
  created() {
    const deviceId = this.$route.query && this.$route.query.id;
    this.getUserInfo(deviceId);
    this.getTagParent(deviceId);
  },
  methods: {
    getUserInfo(id) {
      getUserInfo(id).then(response => {
        this.userInfoData = response.data;
      });
    },
    getTagParent(id) {
      getUserinfotagsByType(id).then(response => {
        console.log("response.data="+response.data);
        console.log("response.data.mapList="+response.data.mapList);
        this.data = response.data.mapList;
        console.log("this.data="+this.data);
        this.otherData.allTagCount = response.data.allTagCount;
      });
      // getTagParentSelect().then(response => {
      //   this.tagsData = response.data;
      //   this.data = response.data.children;
      // });
    },
    handleNodeClick(data) {
      console.log(data);
      let id = data.id;
      console.log(id);
      // getUserinfotagsByType(id).then(response => {
      //   this.data = response.data.mapList;
      // });

    }
  }
};
</script>
<style rel="stylesheet/scss" lang="scss">
.content-container{
  width: 100%;
  overflow-y: auto;
  min-width: 1280px;
  padding: 0 40px;
  background: #f7f9fa;
  display: flex;
  flex-direction: column;
  .content-left{
    padding: 20px 14px 12px;
    background-color: #fff;
  }
  .content-right{
    //background-color: #fff;
  }
}
.index__profile-item___2Ep7n {
  margin-top: 20px;
  border-bottom: 1px solid #d3dce6;
  padding-top: 6px;
  padding-left:10px;

  .index__profile-item-box___3v5O7 {
    margin-bottom: 26px;
  }

  .index__profile-item-box___3v5O7 > label {
    display: block;
    font-size: 12px;
    color: #8492a6;
    line-height: 17px;
    margin-bottom: 5px;
  }

  .index__profile-item-box___3v5O7 > span {
    font-weight: 500;
    color: #475669;
    line-height: 20px;
    font-size: 14px;
    display: inline-block;
    word-break: break-all;
  }
}
.index__content___3xrWj {
  flex: 1;
  margin-left: 18px;
  overflow-y: hidden;
  margin-bottom: 40px;
  .index__model_tags___1-PXC {
    border-color: #1890ff;
    background-color: #fff;
    margin-bottom: 18px;
    padding: 20px 20px 5px;
    overflow: hidden;
    .index__tags___24Vkg {
      display: flex;
      float: left;
      flex-wrap: wrap;
      .index__tag___3Ug-V {
        padding: 6px 25px;
        border-radius: 16px;
        background-color: #eff2f7;
        margin-bottom: 20px;
        margin-right: 10px;
        display: flex;
        align-items: center;
        overflow: hidden;
        white-space: nowrap;
        cursor: pointer;
        color: #475669;
      }
      .index__tag___3Ug-V>span:first-child {
        margin-right: 4px;
        text-overflow: ellipsis;
        overflow: hidden;
        display: inline-block;
        white-space: nowrap;
      }
      .index__tag___3Ug-V>span:nth-child(2) {
        margin-right: 10px;
      }
      .index__tag___3Ug-V:hover{
        background-color: #99a9bf;
      }
    }
  }
  .index__all_tags___3HoCH {
    background-color: #fff;
    padding: 20px 20px 5px;
    overflow: hidden;
  }
}

.labelTit {
  .el-input__inner {
    padding: 0;
    border: 0;
    width:90px;
    font-weight: bold;
  }
  .el-input__suffix {
    right: 0;
    background-color: #fff;
    display: flex;
  }
}
.index__title___3e4ql {
  color: #1f2d3d;
  font-size: 16px;
  font-weight: 500;
  line-height: 22px;
  margin-bottom: 8px;
}
.index__desc___D3hEk {
  font-size: 14px;
  font-weight: 400;
  color: #8492a6;
  line-height: 20px;
}
.el-tree-node__label {
  cursor: pointer;
  font-size: 14px;
  display: inline-flex;
  align-items: center;
  color: #475669;
  height: 30px;
  padding: 0 10px;
  border-radius: 16px;
}
</style>
